﻿using System;
using System.Configuration;
using System.Web.Configuration;

namespace VioletDevelopmentLaboratory.Net.Web.Configuration
{
	public sealed class HttpCookiesSectionManager : ConfigurationManagerBase
	{
		private HttpCookiesSection section;

		public HttpCookiesSectionManager()
		{
			this.section = (HttpCookiesSection)base.GetConfigurationSection("system.web/httpCookies");
		}

		public void Modify(string domain, bool httpOnlyCookies, bool requireSSL)
		{
			if (domain == null)
			{
				domain = "";
			}

			this.section.Domain = domain;
			this.section.HttpOnlyCookies = httpOnlyCookies;
			this.section.RequireSSL = requireSSL;

			this.Save();
		}

		public HttpCookiesSection GetHttpCookies()
		{
			return this.section;
		}
	}
}
